﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var text1 = textBox1.Text;
            var text2 = textBox2.Text;
            var text3 = textBox3.Text;

            var uid = !string.IsNullOrEmpty(text1);
            var pwd = !string.IsNullOrEmpty(text2);
            var pwd1 = text2 == text3;

            if (uid && pwd && pwd1)
            {
                MessageBox.Show("注册成功！");
                Form1.users.Add(text1, text2);
                Form1 form1 = new Form1();
                this.Hide();
                form1.Show();
            }
            else
            {
                MessageBox.Show("注册失败");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            Form1 form1 = new Form1();
            this.Hide();
            form1.Show();
        }
    }
}
